* Load data
use "$data/main_touse.dta", replace

* Drop hyp high observations
drop if ctb==4

/*
* Labels
label var age1834 "Age: 18-34" 
label var age3549 "Age: 35-49" 
label var age5064 "Age: 50-64" 
label var age65above "Age: 65+"

label drop inc_group_lab
lab define inc_group_lab 1 "Low" 2 "Lower Middle" 3 "Upper Middle" 4 "High"
label values inc_group inc_group_lab
label var inc_group "Income Groups"
tab inc_group

label var inc_lmiddle "Income: Lower Middle"

lab var hs "HS Graduate"
lab var some_college "Some College"
lab var less_than_hs "Less than HS"


lab define white_lab 0 "Non-White" 1 "White"
lab values white white_lab

*inc_umiddle inc_high
*/
* Table A15: Quantile regressions of patience on sociodemographics 
global varlist="patience_ctb_trim patience_sc patience_self"

xi: qreg patience_ctb_trim
outreg2 using "$output/TableA15.xls", ctitle("") excel bdec(3) sdec(3) stats(coef se) replace

foreach dv in $varlist  {
qreg `dv' ///
age3549 age5064 age65above ///
hs some_college ba_or_more ///
i.inc_group ///
female white ///
, vce(robust)
outreg2 using "$output/TableA15.xls", ctitle("`dv'") excel bdec(3) sdec(3) stats(coef se) append
 
* Adding ideology
qreg `dv' ///
age3549 age5064 age65above ///
hs some_college ba_or_more ///
i.inc_group ///
female white ///
ideo_right ideo_middle ///
, vce(robust)
outreg2 using "$output/TableA15.xls", ctitle("`dv'") excel bdec(3) sdec(3) stats(coef se) append


* Adding partisanship
qreg `dv' ///
age3549 age5064 age65above ///
hs some_college ba_or_more ///
i.inc_group ///
female white ///
republican independent ///
, vce(robust)
outreg2 using "$output/TableA15.xls", ctitle("`dv'") excel bdec(3) sdec(3) stats(coef se) append
}
